pub mod database;
pub mod query;
pub mod schema;

pub use database::DatabaseManager;
pub use query::{QueryProcessor, QueryResult};
pub use schema::{SchemaManager, TableInfo, ColumnInfo};

use anyhow::Result;

/// Core database management functionality
#[derive(Debug)]
pub struct CdbCore {
    database_manager: DatabaseManager,
    query_processor: QueryProcessor,
    schema_manager: SchemaManager,
}

impl CdbCore {
    /// Create a new CdbCore instance
    pub async fn new() -> Result<Self> {
        let database_manager = DatabaseManager::new().await?;
        let query_processor = QueryProcessor::new();
        let schema_manager = SchemaManager::new();
        
        Ok(Self {
            database_manager,
            query_processor,
            schema_manager,
        })
    }
    
    /// Get the database manager
    pub fn database_manager(&self) -> &DatabaseManager {
        &self.database_manager
    }
    
    /// Get the query processor
    pub fn query_processor(&self) -> &QueryProcessor {
        &self.query_processor
    }
    
    /// Get the schema manager
    pub fn schema_manager(&self) -> &SchemaManager {
        &self.schema_manager
    }
}
